/******************************************************************************
** @file	test_cm_collectionitem.cpp
** @author  Joel Chuca
**
** @date	Sep 01, 2010
**
** @desc	This testSuite tests the insertion and selection of 
**          collectionitem object.
*			
******************************************************************************/
#include "unit--/unit--.h"
#include "cm_dblitemanager.h"
#include "cm_collectionitem.h"
#include <string>
#include <iostream>

using namespace std;
using namespace unit_minus;

testSuite(CacheManager);

testCase(saveCollectionTimeTest, CacheManager)
{
    cout << "----- Start saveCollectionTimeTest -----" << endl;
    CM_DBLiteManager manager ;
	manager.initialize();

    CM_CollectionItem collItem;
    int collId = collItem.saveCollectionTime(1);
    assertTrue(collId > 0)
    cout << "------- End saveCollectionTimeTest -----" << endl;
}

testCase(getCollectionLastIdTest, CacheManager)
{
    cout << "----- Start getCollectionLastIdTest -----" << endl;
    CM_DBLiteManager manager ;
	manager.initialize();

    CM_CollectionItem collItem;
    int collId = collItem.saveCollectionTime(1);
    int lastId = collItem.getCollectionLastId(1);
    assertTrue(collId == lastId);
    cout << "------- End getCollectionLastIdTest -----" << endl;
}

testCase(getCollectionBeforeLastIdTest, CacheManager)
{
    cout << "----- Start getCollectionBeforeLastIdTest -----" << endl;
    CM_DBLiteManager manager ;
	manager.initialize();

    CM_CollectionItem collItem;
    int collId = collItem.saveCollectionTime(1);
    int collId2 = collItem.saveCollectionTime(1);
    int beforeLastId = collItem.getCollectionBeforeLastId(1);
    assertTrue(beforeLastId == collId);
    cout << "------- End getCollectionBeforeLastIdTest -----" << endl;
}